-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Reland "Avoid repo mapping lookup to check builtin restrictions" #28217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This reverts commit 7111cbf, with an additional fallback to a repo mapping lookup for the main repo to accomodate the tests in rules_cc and rules_java.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR relands a previously reverted performance optimization that avoids expensive repository mapping lookups when checking builtin API access restrictions. The original regression has been fixed by adding a fallback to repo mapping lookup specifically for the main repository case to accommodate tests in rules_cc and rules_java.
Changes:
- Introduced
reposMatch()helper method that optimizes repository name matching by avoidingRepositoryMapping.get()calls in most cases - Replaced string-based comparison with constant-based comparison for the
_builtinsrepository check - Added import for
RepositoryNameclass
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/main/java/com/google/devtools/build/lib/packages/BuiltinRestriction.java
Show resolved
Hide resolved
|
@bazel-io fork 9.0.0 |
This reverts commit 7111cbf, which in turn reverted cecc26b. The regression is fixed by adding an additional fallback to a repo mapping lookup for the main repo to accommodate the tests in rules_cc and rules_java. The restructuring of the checks also results in a further improvement down to a 1% slowdown incurred by the checks (vs. 10-20% before this change). Closes bazelbuild#28217. PiperOrigin-RevId: 855249997 Change-Id: I7da63fa9d6727a771e94be86bf62e7a6f957cfc7
…ns" (#28254) This reverts commit 7111cbf, which in turn reverted cecc26b. The regression is fixed by adding an additional fallback to a repo mapping lookup for the main repo to accommodate the tests in rules_cc and rules_java. The restructuring of the checks also results in a further improvement down to a 1% slowdown incurred by the checks (vs. 10-20% before this change). Closes #28217. PiperOrigin-RevId: 855249997 Change-Id: I7da63fa9d6727a771e94be86bf62e7a6f957cfc7 Commit 37fb3c5 Co-authored-by: Fabian Meumertzheim <[email protected]>
This reverts commit 7111cbf, which in turn reverted cecc26b.
The regression is fixed by adding an additional fallback to a repo mapping lookup for the main repo to accommodate the tests in rules_cc and rules_java. The restructuring of the checks also results in a further improvement down to a 1% slowdown incurred by the checks (vs. 10-20% before this change).